package com.gpStudy.design.single;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;

public class BreakSingletonEnumTest {
    public static void main(String[] args) {

//        EnumSingleton o1 = null;
//        EnumSingleton o2 = EnumSingleton.getIns();
//        EnumSingleton1 o3 = EnumSingleton1.getInstance();
//        o2.setData(new Object());
//
//        FileOutputStream fos = null;
//        try {
//
//            fos = new FileOutputStream("LazySingleton.obj");
//
//            ObjectOutputStream oos = new ObjectOutputStream(fos);
//            oos.writeObject(o2);
//            oos.flush();
//            oos.close();
//
//            FileInputStream fis = new FileInputStream("LazySingleton.obj");
//            ObjectInputStream ois = new ObjectInputStream(fis);
//            o1 = (EnumSingleton)ois.readObject();
//
//            System.out.println(o1 == o2);
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }


        Class<EnumSingleton> clazz = EnumSingleton.class;
        Method[] methods = clazz.getMethods();
        for (Method m :methods){
            System.out.println(m.toString());
        }


    }
}
